<?php


class Crc_Bootstrap_Resource_Log extends Zend_Application_Resource_ResourceAbstract
{
    public function init()
    {
        $logger = new Zend_Log();
        $writer = 'production' == $this->getBootstrap()->getEnvironment() ?
                    new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/logs/app.log') :
                    new Zend_Log_Writer_Firebug();
        $logger->addWriter($writer);
        if ('production' == $this->getBootstrap()->getEnvironment())
        {
            $filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT);
            $logger->addFilter($filter);
        }
        Zend_Registry::set('log', $logger);

        return $logger;
    }
}